Validate a little nicer

Glenn 'devalias' Grant 10 years ago
parent
commit
4b48a6e578
1 changed files with 2 additions and 4 deletions
  1. 2 4
      app/models/agents/twitter_user_agent.rb

+ 2 - 4
app/models/agents/twitter_user_agent.rb

@@ -63,10 +63,8 @@ module Agents
63 63
     end
64 64
 
65 65
     def validate_options
66
-      unless options['username'].present? &&
67
-        options['expected_update_period_in_days'].present?
68
-        errors.add(:base, "username and expected_update_period_in_days are required")
69
-      end
66
+      errors.add(:base, "username is required") unless options['username'].present?
67
+      errors.add(:base, "expected_update_period_in_days is required") unless options['expected_update_period_in_days'].present?
70 68
 
71 69
       if options[:include_retweets].present? &&
72 70
         !(!!options[:include_retweets] === true || !!options[:include_retweets] === false)